var app = getApp()
const server=require('../../utils/server.js');
Page({
	data: {
    cards:[],
    paegSize:1,
    pageNum:10,
    current:"",
    orderStatus:[
      "商家接单中",
      "商家已接单",
      "骑手正在赶往商家",
      "骑手正在前往商家",
      "骑手配送中",
      "订单已完成",
      "退返货"
    ]
  },
	onLoad: function () {
    this.getOrderList('');
    let that=this;
    that.setData({
      imgUrl:wx.getStorageSync('imgUrl')
    })
  },
	onShow: function() {},
  
  getOrderList(id){
    let uid = wx.getStorageSync('uid');
    let that = this;
    
    server.postReq('/modele/orderForm/lockOrderForm', {
      userId: uid,
      
      orderFormStatus:id,
     
    }, function (res) {
      if (res.data.code == 1) {
        
        
        that.setData({
          cards: res.data.data
        })
      }else{
        that.setData({
          cards: []
        })
        wx.showToast({
          title: '无结果 ',
        })
      }
    })
  },
  onScroll(){
    // var that = this;
    // console.log("划过了" + e.detail.scrollTop);

    // var n = Number(that.data.shops.length) * 100 + 116;

    // if (e.detail.scrollTop > n && !this.data.scrollDown) {

    //   this.setData({
    //     scrollDown: true
    //   });
    //   var pageSize = that.data.pageSize;
    //   pageSize++;
    //   that.setData({
    //     pageSize: pageSize
    //   })
    //   that.getOrderList(pageSize,'');
    // } else if (e.detail.scrollTop < n && this.data.scrollDown) {
    //   this.setData({
    //     scrollDown: false
    //   });


    // }
  },
  handleChange({detail}) {
    console.log(detail.key)
    this.setData({
      current:detail.key
    })
    this.getOrderList(detail.key) 
  },
  orderDetail() {
    wx.navigateTo({
      url: '../orderDetail/orderDetail',
    })

  }
});

